from pms.common.views import PostFormula
from info.models import MailReceive
from info.utils.mail import mail_view


class API(PostFormula):
    def handle(self, req):
        receive = MailReceive.objects.get(uid=self.user, mid_id=req['id'])
        view = mail_view(receive.mid)
        receive.is_delete = True
        receive.save()
        return self.success_respond(view)
